Repository navigation
fix: display percentage values - #49
Conversation
There was a problem hiding this comment.
Pull request overview
This PR corrects alert annotation rendering for PromQL expressions that already return 0–100 scale percentages, preventing inflated % values in notifications, and updates related chart/plugin metadata.
Changes:
- Replaced
humanizePercentagewithhumanize+ literal%for affected 0–100 alert values (API availability, node CPU %, node disk usage %), and fixed the CPU alert’sdigkey + missing space in the message. - Simplified
KubeletManyRequestErrorsthreshold expression from* 100 > 1to the equivalent> 0.01. - Bumped chart/plugin versions (but currently inconsistent with the PR description and with each other).
Reviewed changes
Copilot reviewed 5 out of 5 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| charts/kubernetes-operations/plugindefinition.yaml | Bumps PluginDefinition version and referenced Helm chart version. |
| charts/kubernetes-operations/Chart.yaml | Updates the Helm chart version. |
| charts/kubernetes-operations/alerts/kubernetes-node.yaml | Fixes CPU and disk percentage annotation formatting and corrects the dig key for CPU alert config overrides. |
| charts/kubernetes-operations/alerts/kubernetes-kubelet.yaml | Rewrites the request error ratio threshold to an equivalent non-percent form. |
| charts/kubernetes-operations/alerts/kubernetes-apiserver.yaml | Fixes aggregated API availability annotation formatting to avoid double-scaling percent. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
KubeAggregatedAPIDown, KubernetesNodeHostHighCPUUsage, and KubernetesNodeHighDiskUsagePercentage all produce PromQL values on a 0-100 scale. humanizePercentage expects a 0-1 ratio and multiplies by 100, causing values like 81.82 to render as 8182% in notifications. Also fix typo: missing space before "has" in KubernetesNodeHostHighCPUUsage description. Bump chart version 1.3.0 -> 1.3.1 Bump plugindefinition spec.version 1.2.0 -> 1.2.1 and helmChart.version 1.3.0 -> 1.3.1 Signed-off-by: jeoffzheng <jeoff.zheng@sap.com>
a787b56 to
ad0e83e
Compare
viennaa
left a comment
There was a problem hiding this comment.
Thanks for spotting and acting on this problem. Little suggestion from my side.
Replace `humanize` with `printf "%.2f"` in all three alert descriptions to ensure consistent 2-decimal-place output. humanize can produce abbreviated values (1.1k, 1M) which is unsuitable for percentages. Also move the literal % outside the backtick-formatted value. Addresses review feedback from viennaa on PR cloudoperators#49.
Replace `humanize` with `printf "%.2f"` in all three alert descriptions to ensure consistent 2-decimal-place output. humanize can produce abbreviated values (1.1k, 1M) which is unsuitable for percentages. Also move the literal % outside the backtick-formatted value. Addresses review feedback from viennaa on PR cloudoperators#49. Signed-off-by: jeoffzheng <jeoff.zheng@sap.com>
337e9c1 to
f092f14
Compare
|
@viennaa , thanks for the comments, update the PR with the changes. please review it again. thx. |
|
Please adjust the description and PR title to reflect the actual change. Also don't write down what function has changed to which function in the title, as this can be seen in the diff. Rather have the reasoning in it. |
yeah.. sorry for missing this part... now all updated. |
printf "%.2f" renders literal double-quotes into the YAML value. Unquoted YAML scalars and double-quoted strings both break when they contain unescaped double-quotes. Switch the three affected annotations to single-quote YAML scalars so the inner double-quotes are safe. Signed-off-by: jeoffzheng <jeoff.zheng@sap.com>
|
Can you add the fix to this file too for: KubeletTooManyPods |
ea8b45d to
e8f0913
Compare
both alerts KubeletTooManyPods & KubeletManyRequestErrors — the value is 0–1 ratio , so this one actually is a 0–1 scale and humanizePercentage would be correct... |
Fix
correct the percentage value display in the alerts
Chart version
Bumped
1.3.0→1.3.1